/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.koozi;

import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;

/**
 *
 * @author Sven-Ove Bjerkan
 */
public class FileFolder {
    public static String fileToString(String file) {
        String result = null;
        DataInputStream in = null;

        try {
            java.io.File f = new java.io.File(file);
            byte[] buffer = new byte[(int) f.length()];
            in = new DataInputStream(new FileInputStream(f));
            in.readFully(buffer);
            result = new String(buffer);
        } catch (IOException e) {
            throw new RuntimeException("IO problem in fileToString", e);
        } finally {
            try {
                in.close();
            } catch (IOException e) { /*
                 * ignore it
                 */

            }
        }
        return result;
    }
}
